﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>处理任务</title>
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="yes" name="apple-touch-fullscreen">
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="css/ydui.css?v=1.1.7" rel="stylesheet" />
    <script src="js/ydui.flexible.js"></script>
    <link rel="stylesheet" type="text/css" href="css/mui.picker.min.css" />
    <link rel="stylesheet" type="text/css" href="css/all.css?v=2018041801" />

    <style type="text/css">
        .cell-right input[type=radio], .cell-right input[type=checkbox]:not(.m-switch) {
            width: 100%;
            left: 0;
            height: 1rem;
            outline: none;
            -webkit-appearance: none;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            resize: none;
            box-sizing: border-box;
            border: none;
        }

        .mui-btn {
            border: none;
        }

        .mui-btn-blue {
            color: #1cbb7f;
        }

        .mui-dtpicker-title {
            color: #2A2A2A;
        }

        .mui-picker {
            background: #F5F5F5;
        }

        .classify-title {
            float: left;
            width: 30%;
            font-size: .28rem;
            margin: 0 !important;
            text-align: center;
            position: relative;
        }

            .classify-title:after {
                content: '';
                position: absolute;
                z-index: 0;
                bottom: 0;
                right: 0;
                width: 1px;
                height: 100%;
                border-right: 1px solid #D9D9D9;
                -webkit-transform: scaleX(0.5);
                transform: scaleX(0.5);
                -webkit-transform-origin: 100% 0;
                transform-origin: 100% 0;
            }

            .classify-title span {
                font-size: .24rem;
                margin-left: .15rem;
            }
        .waitrecordlist .list-box .box-text .info2 {
            font-size: .24rem;
            color: #A6A5A5;
        }
    </style>
</head>
<body ms-controller="gzrzview" class="ms-controller">
    <div class="g-flexview">
        <div class="title" style="height:100px;background: #44A9FF url(/View_Mobile/UI/GZRZ/images/bg-account.jpg) 100% 100%;">
            <div style="color:#fff;margin-top:40px;font-size:.4rem; margin-left:20px; ">
                处理任务
            </div>
        </div>
        <div class="classify-input" style="padding: .2rem .15rem;">
            <div style="background: #fff;" class="clearfix">
                <input type="text" class="iconfont" placeholder="&#xe6cb;输入日志内容或者姓名搜索" id="" style="width:70%;border-radius: 0;" />
            </div>
        </div>
        <div class="g-scrollview">
            <div class="waitrecordlist">
                <div class="list-box clearfix" ms-repeat-el="ListData">
                    <div class="box-btn">
                        <label class="cell-right">
                            <input type="checkbox" ms-attr-value="el.logId" name="checkbox" class="logsel" >
                            <i class="cell-checkbox-icon"></i>
                        </label>
                    </div>
                    <div class="box-text">
                        <p class="list-title"><span style="width:70%;overflow:hidden;text-overflow: ellipsis;color:#2A2A2A;" class="fl">[{{el.work_date}}]-{{el.userName}}-{{el.taskName}}</span><span class="fr">正常({{el.billingHours}})，加班({{el.overworkHours}})</span></p>
                        <p class="info" ms-if="el.billingHoursDesc">{{el.billingHoursDesc}}{{el.overworkHoursDesc}}</p>
                        <div class="info2" style="display:none;">
                            <p ms-if="el.billingHoursDesc">
                                <span>【工作日志】</span>
                                <span style="color:#2A2A2A;">{{el.billingHoursDesc}}</span>
                            </p>
                            <p ms-if="el.overworkHoursDesc">
                                <span>【加班日志】</span>
                                <span style="color:#2A2A2A;">{{el.overworkHoursDesc}}</span>
                            </p>
                        </div>
                    </div>
                </div>

            </div>
        </div>
        <!--<div class="m-actionsheet" id="J_ActionSheet">
            <a href="#" class="actionsheet-item">示例菜单 - Data API</a>
            <a href="#" class="actionsheet-item">示例菜单 - Data API</a>
            <a href="#" class="actionsheet-item">示例菜单 - Data API</a>
            <a href="#" class="actionsheet-item">示例菜单 - Data API</a>
            <a href="javascript:;" class="actionsheet-action" id="cancel">取消</a>
        </div>-->
        <footer class="m-tabbar" style="padding: 0;">
            <div class="tabbar-item">
                <a href="javascript:;" class="btn-block btn-hollow" style="border-radius: 0;font-size: .3rem;" ms-visible="IsAll" ms-click="SelAll(1)">全选</a>
                <a href="javascript:;" class="btn-block btn-hollow" style="border-radius: 0;font-size: .3rem;" ms-visible="!IsAll" ms-click="SelAll(2)">取消全选</a>
            </div>
            <div class="tabbar-item">
                <a href="javascript:;" class="btn-block btn-primary" style="border-radius: 0;font-size: .3rem;" ms-click="CheckRW(1)">同意</a>
            </div>
            <div class="tabbar-item">
                <a href="javascript:;" class="btn-block btn-danger" style="border-radius: 0;font-size: .3rem;" ms-click="CheckRW(2)">拒绝</a>
            </div>

        </footer>
    </div>


    <script src="https://cdn.bootcss.com/jquery/2.2.0/jquery.min.js"></script>
    <script src="../../JS/layer/layer.m.js"></script>
    <script src="js/ydui.js"></script>
    <script src="/View_Mobile/JS/avalon1.47.js"></script>
    <script src="/View_Mobile/JS/ComFunJS.js?jsver=20160425"></script>
    <script>
        //	    !function ($) {
        //    var $myAs = $('#J_ActionSheet');
        //    $('.classify-title').on('click', function () {
        //        $myAs.actionSheet('open');
        //    });
        //    $myAs.on('open.ydui.actionsheet', function () {
        //        console.log('打开了');
        //    }).on('close.ydui.actionsheet', function () {
        //        console.log('关闭了');
        //    });
        //}(jQuery);

        var model = avalon.define({
            $id: "gzrzview",
            ListData: [],
            pageindex: 1,
            total: 0,
            status: "",
            GetListData: function (callback) {
                $.getJSON("/API/VIEWAPI.ashx?action=OUTAPI_GETMYAPPROVELOGBYUDS", { "pageNo": model.pageindex, "pageSize": 10, "logStatus": 1, "allFlag": false }, function (r) {
                    if (r.ErrorMsg == "") {
                        var r2 = JSON.parse(r.Result);
                        typeof callback == 'function' && callback.call(this, r2);
                    }
                })
            },
            Query: function (s) {
                model.status = s;
                init();

            },
            IsAll:true,
            SelAll: function (t) {
                if (t == 1) {
                    $(".logsel").prop("checked", true);
                    model.IsAll = false;
                } else {
                    $(".logsel").prop("checked", false);
                    model.IsAll = true;
                }
            },
            CheckRW: function (t) {
                var logids = "";
                $(".logsel").each(function () {
                    if ($(this).prop("checked")) {
                        if (logids == "") {
                            logids = $(this).val();
                        } else {
                            logids += "," + $(this).val();
                        }
                    }
                })

                if (!logids) {
                    ComFunJS.winwarning("请选择工作日志");
                    return;
                }

                var desp = "确定要审批通过吗？";
                var auditType = "2";
                if (t == 2) {
                    desp = "确定要拒绝吗？";
                    auditType = "3";
                }

                ComFunJS.confirm(desp, function () {

                    $.getJSON("/API/VIEWAPI.ashx?Action=OUTAPI_APPROVELOGBYIDS&r=" + Math.random(), { "auditType": auditType, "logIds": logids }, function (resultData) {
                        if (resultData.ErrorMsg == "") {
                            ComFunJS.winsuccess("提交成功");
                            setTimeout(function () {
                                window.location.replace(updateUrl(window.location.href, 'r'));
                            }, 2000);

                        }

                    })

                })

            }
        })
        avalon.ready(function () {
            if (!ComFunJS.iswx()) {
                window.location.href = "../UI_Error.html?msg=请在微信端打开";
            }
            init();

        })

        function updateUrl(url, key) {
            var key = (key || 't') + '='; //默认是“t”
            var reg = new RegExp(key + '\\d+');//正则：t=1472286066028
            var timestamp = +new Date();
            if (url.indexOf(key) > -1)//有时间戳，直接更新
            {
                return url.replace(reg, key + timestamp);
            }
            else //没有时间戳，加上时间戳
            {
                if (url.indexOf('\?') > -1) {
                    var urlArr = url.split('\?');
                    if (urlArr[1]) {
                        return urlArr[0] + '?' + key + timestamp + '&' + urlArr[1];
                    }
                    else {
                        return urlArr[0] + '?' + key + timestamp;
                    }
                }
                else {
                    if (url.indexOf('#') > -1) {
                        return url.split('#')[0] + '?' + key + timestamp + location.hash;
                    }
                    else {
                        return url + '?' + key + timestamp;
                    }
                }
            }
        }

        function init() {
            model.ListData.clear();
            model.pageindex = 1;

            $('.waitrecordlist').infiniteScroll({
                binder: '.g-scrollview',
                pageSize: 10,
                initLoad: true,
                backposition: true,
                jumpLink: '.J_Link',
                loadingHtml: '<img src="http://static.ydcss.com/uploads/ydui/loading/loading10.svg"/>',
                loadListFn: function () {
                    var def = $.Deferred();

                    model.GetListData(function (listArr) {
                        listArr.forEach(function (val) {
                            model.ListData.push(val);
                        });
                        //$('.m-list').find('img').lazyLoad({ binder: '.g-scrollview' });

                        def.resolve(listArr, model.pageindex);
                        model.pageindex++;

                        $(".box-text").click(function () {
                            if ($(this).find(".info").css("display") == 'none') {
                                $(this).find(".info").css("display", "block");
                                $(this).find(".info2").css("display", "none");
                            } else {
                                $(this).find(".info").css("display", "none");
                                $(this).find(".info2").css("display", "block");
                            }

                        })

                    })

                    
                    

                    return def.promise();
                },
                loadStorageListFn: function (ret, retPage) {
                    var def = $.Deferred();
                    model.pageindex = retPage;
                    ret.forEach(function (listArr) {
                        listArr.list.forEach(function (val) {
                            model.ListData.push(val);
                        });
                    });
                    model.total = model.ListData.length;
                    //$('.m-list').find('img').lazyLoad({ binder: '.g-scrollview' });
                    def.resolve();
                    return def.promise();
                }
            })

        }

    </script>
</body>
</html>
